package com.befirefly.studentmanager.util;

import javax.swing.*;
import java.awt.*;

/**
 * @Author: 八千里路云和月
 * @Date: 2021/2/7 20:39
 * @Description:
 */
public class DimensionUtil {

    public static Rectangle getBounds() {
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        // 保证主界面不会覆盖电脑屏幕的任务栏
        Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(new JFrame().getGraphicsConfiguration());
        Rectangle rectangle = new Rectangle(screenInsets.left, screenInsets.top, screenSize.width - screenInsets.left - screenInsets.right, screenSize.height - screenInsets.top - screenInsets.bottom);
        return rectangle;
    }
}
